package Dao;

import java.io.IOException;
import java.io.InputStream;
import java.util.List;

import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;

import Entity.Room;
import mapper.Coursemapper;
import mapper.Roommapper;

public class roomdao implements Roommapper {
	private  static Roommapper roommapper;
	private  static SqlSession session;

	public roomdao() throws IOException {
	 	String resource ="mybatis-config.xml";
		InputStream inputstream = Resources.getResourceAsStream(resource);
		SqlSessionFactory sqlsessionfactory = new SqlSessionFactoryBuilder().build(inputstream);
		 session = sqlsessionfactory.openSession();
       roommapper = session.getMapper(Roommapper.class);
    }
	public void close(){
		this.session.close();
	}
	public List<Room> Room_query_all() {
		
		List<Room> selectList = this.roommapper.Room_query_all();

		return selectList;
	}
}
